/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package padraoMemento;

import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import model.Disciplina;

/**
 *
 * @author micro
 */
public class MementoDisciplina{
     private static ArrayList<Disciplina> disciplinas= new ArrayList<Disciplina>();
  
     public static void adicionarDisciplina(Disciplina disciplina){
         Disciplina disciplinaNova= new Disciplina();
         disciplinaNova = disciplina;
         disciplinas.add(disciplinaNova); 
     }
     
     public static void excluirDisciplina(Disciplina disciplina){
         
                 
        for(Disciplina x:disciplinas){
             
            if (x.getEmenta().equals(disciplina.getEmenta()) && x.getNome().equals(disciplina.getNome())&& x.getCodDisciplina()== disciplina.getCodDisciplina() && x.getQtdeCreditos()== disciplina.getQtdeCreditos()){
               
                disciplinas.remove(disciplinas.indexOf(x));
                return;
            }
         }
        
     }
      public static void excluirDisciplina(int id){
      disciplinas.remove(id);
      }
    
    public static Disciplina obterDisciplina(int id  ){
     return disciplinas.get(id);
        
 
     }
     
   public static List<Disciplina> obterDisciplinasAlteradas(){
       return disciplinas;
   }
}
